Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not set crossOrigin for file protocol #9854

Merged
merged 1 commit into from
Oct 20, 2023
Merged

Conversation

zbynek
Copy link
Contributor

@zbynek zbynek commented Sep 21, 2023

This allows using GWT compiled code with installCode=false also with file:// protocol.

See #9734 (comment) for the relevant Chrome error message.

@niloc132
Copy link
Member

To confirm, this change makes it possible to open the page, but the stack traces will still not work (since a file: url can't opt-in to supporting cross-origin requests)?

@zbynek
Copy link
Contributor Author

zbynek commented Sep 27, 2023

After this change I get a Java stacktrace in Chrome and source map seems to work even with

  • file:// protocol used both for JS and document
  • localhost used for JS, file:// protocol used for document
    For uncaught exception the stacktrace looks the same as if and http:// was used for document
    image

For caught exceptions that go through logger with exception unwrapping utility the stacktrace for file:// and http:// is slightly different
image
vs
image
Note that the code doesn't use GWT's builtin UncaughtExceptionHandler but a custom onerror handler.

@niloc132
Copy link
Member

Nice - that's pretty much exactly what was failing that caused us to add this to begin with, glad it isn't necessary here.

@tbroyer
Copy link
Member

tbroyer commented Sep 28, 2023

Correct me if I'm wrong but it looks like there's no stack trace then. What does it look like without the custom error handling code? (I suppose the same without the white text?)

@zbynek
Copy link
Contributor Author

zbynek commented Sep 28, 2023

no stack trace then.

yep, but still the dev tools show you all the filenames and line numbers.

What does it look like without the custom error handling

I guess very similar. The custom code is there just to

  1. make sure the native JS exception is printed to the console, not the wrapping Java Exception (just saves you some clicks expanding objects in console)
  2. work around Avoid calling undefined method in UncaughtExceptionHandler gwt-core#18

Bottom line: for file:// protocol the script didn't start before, now it starts. For http:// protocol nothing changed in this PR.

@niloc132 niloc132 merged commit abceee4 into gwtproject:main Oct 20, 2023
@zbynek zbynek deleted the patch-2 branch October 20, 2023 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants